#!/usr/bin/env python
# coding=utf-8

# File Name: testPython.py
# Author: Bill Zhang
# Mail: zchcandid@gmail.com 
# Created Time: Mon 28 Oct 2013 02:06:06 PM CST
import mysql.connector
from mysql.connector import errorcode

try:
      cnx = mysql.connector.connect(user='admin001', password='admin001',host='127.0.0.1',database='icmall')
except mysql.connector.Error as err:
      if err.errno == errorcode.ER_ACCESS_DENIED_ERROR:
          print("Something is wrong with your user name or password")
      elif err.errno == errorcode.ER_BAD_DB_ERROR:
          print("Database does not exists")
      else:
          print(err)
else:
    cnx.close()
